<template>
  <div class="detail" transition="fade">
    <div class="detail-wrapper clearfix">
      <div class="detail-main">
        <h1 class="name">{{seller.name}}</h1>
        <div class="star-wrapper">
          <v-star :size="48" :score="seller.score">{{seller.score}}</v-star>
        </div>
        <div class="title">
          <div class="line"></div>
          <div class="text">优惠信息</div>
          <div class="line"></div>
        </div>
        <ul class="supports">
          <li class="supports-item" v-for="(item,i) in seller.supports" :key="i">
            <span class="icon" :class="classMap[item.type]"></span>
            <span class="text">{{item.description}}</span>
          </li>
        </ul>
        <div class="title">
          <div class="line"></div>
          <div class="text">商家公告</div>
          <div class="line"></div>
        </div>
        <div class="bulletin">
          <p class="content">{{seller.bulletin}}</p>
        </div>
      </div>
    </div>
    <div class="detail-close">
      <span class="icon-close" @click="$emit('closeDetail')"></span>
    </div>
  </div>
</template>
<script>
import star from '../star/Star'
export default {
  data() {
    return {
      classMap: ['decrease', 'discount', 'guarantee', 'invoice', 'special']
    }
  },
  props: ['seller'],
  methods: {},
  components: {
    'v-star': star
  }
}
</script>
<style lang="stylus" scoped>
@import '../../assets/stylus/mixin.styl';

.detail {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(7, 17, 27, 0.8);
  z-index: 100;
  color: #fff;
  transition: all 0.5s;
  backdrop-filter: blur(3px);

  &.fade-transition {
    opacity: 1;
    background-color: rgba(7, 17, 27, 0.8);
  }

  &.fade-enter, &.fade-leave-to {
    opacity: 0;
    background-color: rgba(7, 17, 27, 0);
  }

  .detail-wrapper {
    min-height: 100%;
    width: 100%;

    .detail-main {
      padding-top: 64px;
      padding-bottom: 64px;
      width: 100%;

      .name {
        font-size: 0.32rem;
        line-height: 0.32rem;
        font-weight: 700;
        text-align: center;
      }

      .star-wrapper {
        margin-top: 0.36rem;
        padding: 2px 0;
        text-align: center;
      }

      .title {
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0.56rem auto 0.48rem auto;

        .line {
          width: 2.24rem;
          height: 2px;
          background-color: rgba(255, 255, 255, 0.2);
        }

        .text {
          margin: 0 0.24rem;
          font-weight: 700;
          letter-spacing: 0.06rem;
          font-size: 0.28rem;
        }
      }

      .supports {
        margin-left: 0.72rem;

        .supports-item {
          display: block;
          margin-bottom: 0.24rem;
          font-size: 0.24rem;

          .icon {
            display: inline-block;
            width: 0.32rem;
            height: 0.32rem;
            vertical-align: middle;
            background-repeat: no-repeat;
            background-size: 0.32rem;
            margin-right: 0.12rem;

            &.decrease {
              bg-img('../../assets/imgs/decrease_1');
            }

            &.discount {
              bg-img('../../assets/imgs/discount_1');
            }

            &.guarantee {
              bg-img('../../assets/imgs/guarantee_1');
            }

            &.invoice {
              bg-img('../../assets/imgs/invoice_1');
            }

            &.special {
              bg-img('../../assets/imgs/special_1');
            }
          }

          .text {
            vertical-align: middle;
          }
        }
      }

      .bulletin {
        padding: 0 0.74rem;
        font-size: 0.24rem;
        line-height: 0.48rem;

        .content {
          margin: 0 auto;
        }
      }
    }
  }

  .detail-close {
    position: relative;
    width: 32px;
    height: 32px;
    margin: -64px auto 0 auto;
    clear: both;
    font-size: 32px;
    color: #fff;
  }
}
</style>
